<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of fiscalYear
 *
 * @author nstevens
 */
class fiscalYear {

    public $fy, $totalFunding, $totalAllocated;
    public $projects;

    public function __construct($fy) {
        $this->fy = $fy;
    }

    /**
     * 
     * @param type $level
     * @param type $projectType if NULL->gets all projects, 1=non-approved projects (proposals), 2=gets approved projects only, 3=no projects
     */
    public function init($level, $projectType=NULL) {
        if (strcmp($level, "1") === 0 || strcmp($level, "2") === 0) {
            $this->projects = projectModelClass::getProjectObjects($level, NULL, $projectType);
        }
        $fundingResult = executeSelect("SELECT * FROM fiscalyear WHERE year=$this->fy");
        if ($fundingResult) {
            $row = mysqli_fetch_array($fundingResult);
            $this->totalAllocated = $row['totalAllocated'];
            $this->totalFunding = $row['totalFunding'];
        }
    }

}

?>
